package com.mt.repair.entity.repairManagement;

import javax.persistence.*;
import java.io.Serializable;
import com.mt.common.core.annotation.DColumn;
import com.mt.common.core.annotation.DEntity;
import com.mt.common.core.web.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;



import com.mt.common.system.entity.User;

@DEntity(label="消息中心",comment="",moduleLabel="报修管理")
@Entity(name="repair_message")
@Table(name = "repair_message" , indexes = { @Index(name = "index_to_user_id", columnList = "to_user_id"),@Index(name = "index_from_user_id", columnList = "from_user_id")  })
@ApiModel(description = "消息中心:")
public class Message extends BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;

	@DColumn(index=3,label="接收用户",foreignEntity="User",comment="用户",component="对象选择",where=false)
	@ApiModelProperty(value = "接收用户:用户")
	@Column(name="to_user_id",length=255,nullable=false,unique=false)
	private Long toUserId;

	@Transient
	private User toUser;

	@Transient
	@ApiModelProperty(value = "接收用户名称:用户")
	@DColumn(index=3,label="接收用户",foreignEntity="User",comment="用户")
	private String toUserName;

	@Transient
	@ApiModelProperty(value = "接收用户名称:用户")
	@DColumn(index=3,label="接收用户头像",foreignEntity="User",comment="用户")
	private String toUserAvatar;

	@DColumn(index=4,label="发送用户",foreignEntity="User",comment="用户",component="对象选择",where=false)
	@ApiModelProperty(value = "发送用户:用户")
	@Column(name="from_user_id",length=255,nullable=false,unique=false)
	private Long fromUserId;

	@Transient
	private User fromUser;

	@Transient
	@ApiModelProperty(value = "发送用户名称:用户")
	@DColumn(index=4,label="发送用户",foreignEntity="User",comment="用户")
	private String fromUserName;

	@Transient
	@ApiModelProperty(value = "发送用户名称:用户")
	@DColumn(index=4,label="发送用户头像",foreignEntity="User",comment="用户")
	private String fromUserAvatar;

	@DColumn(index=5,label="发送内容",comment="消息内容",component="文本",where=false)
	@ApiModelProperty(value = "发送内容:消息内容")
	@Column(name="content",length=255,nullable=true,unique=false)
	private String content;

	@DColumn(index=6,label="消息类型",comment="消息类型",component="文本",where=false)
	@ApiModelProperty(value = "消息类型:消息类型")
	@Column(name="type",length=255,nullable=true,unique=false)
	private String type;

	@DColumn(index=7,label="群聊ID",comment="当此字段不为null时，代表是当前的群聊消息，否则为两用户之间私聊",component="数字，整数",where=false)
	@ApiModelProperty(value = "群聊ID:当此字段不为null时，代表是当前的群聊消息，否则为两用户之间私聊")
	@Column(name="group_id",length=255,nullable=true,unique=false)
	private Long groupId;


	public Long getToUserId() {
		return this.toUserId;
	}

	public void setToUserId(Long toUserId) {
		this.toUserId = toUserId;
	}

	public Long getFromUserId() {
		return this.fromUserId;
	}

	public void setFromUserId(Long fromUserId) {
		this.fromUserId = fromUserId;
	}

	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Long getGroupId() {
		return this.groupId;
	}

	public void setGroupId(Long groupId) {
		this.groupId = groupId;
	}

	public User getToUser() {
		return this.toUser;
	}

	public void setToUser(User toUser) {
		if(toUser == null){
		}
		else
		{
		this.toUserId = toUser.getEid();
		this.toUser = toUser;		
		}
}

	public String getToUserName() {
		return this.toUserName;
	}

	public void setToUserName(String toUserName) {
		this.toUserName = toUserName;
	}

	public User getFromUser() {
		return this.fromUser;
	}

	public void setFromUser(User fromUser) {
		if(fromUser == null){
		}
		else
		{
		this.fromUserId = fromUser.getEid();
		this.fromUser = fromUser;		
		}
}

	public String getFromUserName() {
		return this.fromUserName;
	}

	public void setFromUserName(String fromUserName) {
		this.fromUserName = fromUserName;
	}

	public String getToUserAvatar() {
		return toUserAvatar;
	}

	public void setToUserAvatar(String toUserAvatar) {
		this.toUserAvatar = toUserAvatar;
	}

	public String getFromUserAvatar() {
		return fromUserAvatar;
	}

	public void setFromUserAvatar(String fromUserAvatar) {
		this.fromUserAvatar = fromUserAvatar;
	}
}
